<template>
  <div class="profile">
    <nav-bar>
      <div slot="left" @click="back"><img src="../../assets/img/common/back.svg" alt="返回">
      </div>
      <div slot="center">用户中心</div>
    </nav-bar>

      <profile-user></profile-user>
      <!--2.没有单独封装: 不同的地方太多, 需要传过多的参数-->

      <section>
        <div class="account">
          <div class="account-item">
            <div class="number">
              <span class="balance">0.00</span>元
            </div>
            <div class="account-info">我的余额</div>
          </div>
          <div class="account-item">
            <div class="number">
              <span class="balance">0</span>个
            </div>
            <div class="account-info">我的优惠卷</div>
          </div>
          <div class="account-item">
            <div class="number">
              <span class="balance">0</span>分
            </div>
            <div class="account-info">我的积分</div>
          </div>
        </div>

      </section>




    <!-- 封装下面视图-->
    <profile-view :list-data="orderList"  class="order-list"></profile-view>
    <profile-view :list-data="serviceList"  class="service-list"></profile-view>
  </div>
</template>

<script>
import NavBar from '../../components/common/navbar/NavBar'
import ProfileUser from './childrenProfile/profileUser'
import ProfileView from './childrenProfile/profileView'

export default {
  name: 'Wode',
  components: {
    NavBar,
    ProfileUser,
    ProfileView
  },
  data() {
    return {
      orderList: [
        {icon: '#order', iconColor: '#ff8198', info: '我的消息', url:'@/assets/img/profile/message.svg'},
        {icon: '#point', iconColor: '#fc7b53', info: '积分商城',url:'@/assets/img/profile/pointer.svg'},
        {icon: '#vip', iconColor: '#ffc636', info: '会员卡',url:'@/assets/img/profile/vip.svg'},
      ],
      serviceList: [
        {icon: '#service', iconColor: '#ff8198', info: '我的购物车',url:'@/assets/img/profile/cart.svg'},
        {icon: '#download', iconColor: '#ff8198', info: '下载购物APP',url:'@/assets/img/profile/shopping.svg'},
        {icon: '#service', iconColor: '#ff8198', info: '客服热线',url:'@/assets/img/profile/cart.svg'},
      ],
    }
  },
  methods: {
    back() {
      this.$router.push('home')
    }
  }

}
</script>

<style scoped>
.profile {
  background-color: #87cefa;
}

img {
  margin-top: 10px;
  margin-left: 20px;
}

span {
  font-size: 8px;
}
.account{
  display: flex;
}
.account-item {
  background-color: #eeeeee;
  margin-right: 1px;
  flex: 1;
  /*text-align: center;*/
  /*justify-content: center;*/
}

.account-item:last-of-type {
  margin-right: 0;
}
.number{
  display: flex;
  align-items: center;
}
.account-item {
  color: #666;
  font-size: 13px;
  padding: 18px;
}

.account-item .balance {
  font-size: 24px;
  font-weight: 700;
  color: #ff5f3e;
}

.account-info {
  margin-top: 6px;
}

.order-list, .service-list {
  margin-top: 12px;
}
</style>
